public class demo01 {
    public static boolean isQuit=false;
    public static void main(String[] args) {
        Thread t=new Thread(()->{
           while (!isQuit){
               System.out.println("hello 线程1");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
            System.out.println("线程1终止");
        });

        t.start();

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        //修改
        isQuit=true;
    }
}
